import { ApiProperty } from '@nestjs/swagger';
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('codesmsd')
export class CodeSmsd {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  @ApiProperty({ description: '验证码' })
  code: number;

  @Column({ nullable: true })
  @ApiProperty({ description: '邮箱' })
  email?: string;

  @Column({ nullable: true })
  @ApiProperty({ description: '手机号' })
  phone?: string;

  @CreateDateColumn({
    type: 'datetime',
    precision: 0,
    default: () => 'CURRENT_TIMESTAMP(0)',
    onUpdate: 'CURRENT_TIMESTAMP(0)',
  })
  createTime: Date;
}
